<template>
  <div :class="theme">
    <h2>当前主题: {{ theme === 'light' ? '明亮' : '黑暗' }}</h2>
    <button @click="toggleTheme">切换主题</button>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const theme = ref('light')

const toggleTheme = () => {
  theme.value = theme.value === 'light' ? 'dark' : 'light'
}
</script>

<style>
:root {
  --background-color-light: white;
  --text-color-light: black;
  --background-color-dark: black;
  --text-color-dark: white;
}

.light {
  background-color: var(--background-color-light);
  color: var(--text-color-light);
}

.dark {
  background-color: var(--background-color-dark);
  color: var(--text-color-dark);
}
</style>
